using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.CodeRush.StructuralParser;

namespace DX_SourceOutliner
{
    public class SupportedElementTypesNodeProcessor : VisibilityProcessorBase
    {
        IEnumerable<LanguageElementType> _supportedElementTypes;

        /// <summary>
        /// Initializes a new instance of the SupportedElementTypesNodeProcessor class.
        /// </summary>
        /// <param name="options"></param>
        public SupportedElementTypesNodeProcessor(NodeOptions options)
            : base(options)
        {
            _supportedElementTypes = new List<LanguageElementType>()
            {   LanguageElementType.Method, 
                LanguageElementType.Property, 
                LanguageElementType.Event, 
                LanguageElementType.Variable, 
                LanguageElementType.InitializedVariable, 
                LanguageElementType.Class, 
                LanguageElementType.Namespace, 
                LanguageElementType.Interface, 
                LanguageElementType.Delegate, 
                LanguageElementType.Enum, 
                LanguageElementType.EnumElement, 
                LanguageElementType.Struct, 
                LanguageElementType.Module
            };
        }

        protected override bool CheckNodeVisibility()
        {
            if (_source.Element == null) return true;

            return _supportedElementTypes.Contains(_source.Element.ElementType);
        }

    }
}
